Component({
  properties: {
    value: { //数字
      type: Number,
      value: 3
    },
    color: { //颜色
      type: String,
      value: "#333"
    },
    size: { //字体大小
      type: Number,
      value: 18
    },
    isBold: { //是否加粗
      type: Boolean,
      value: false
    }
  },
  data: {
    showNumber:0
  },
  lifetimes: {
    attached: function () {
      this.increaseNumber(0);
    },
  },
  methods: {
    increaseNumber(value){
      let step = 1;
      let num = this.data.value;
      if(num > 50 && num <= 200){
        step = 2;
        if(value > parseInt(num/2)){
          step = 1;
        }
      }else if (num > 200 && num <= 600){
        step = 3;
        if(value > parseInt(num/2)){
          step = 1;
        }
      }else if ( num > 600){
        step = 5;
        if(value > parseInt(num/2) && value <= parseInt(num*3/4)){
          step = 3;
        }else if(value > parseInt(num*3/4)){
          step = 1;
        }
      }
      setTimeout(()=>{
        if(value < num){
          value += step;
          this.setData({
            showNumber:value
          })
          this.increaseNumber(value);
        }
      },10)
    }
  }
})
